<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
    <link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
    <link rel="stylesheet" href="${staticServer}/css/work_today.css" />
    <link rel="stylesheet" href="${staticServer}/css/lanrenzhijia.css" />
    <link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
    <script src="${staticServer}/inc/js/jquery.js"></script>
    <script src="${staticServer}/inc/js/infopad.js?2.2"></script>
    <script src="${staticServer}/inc/js/pageset.js"></script>
	<script src="${staticServer}/inc/js/datepicker.js"></script>
	
	<style>
	.Zebra_DatePicker {
    	z-index: 99999;
	}
	</style>
    <script>
        $(function(){
            $("#nickname").val("${nickName}");

        });

        var selectMsg = function(){
            var nickName = $("#nickname").val();
            var dates = $("#dates").val();
            window.location.href=encodeURI("${contextPath}/index/markList.htm?nickName="+nickName+"&date="+dates);
        }

        var addPerformanceInfo2 = function(){
            window.location.href=encodeURI("${contextPath}/index/markList2.htm");
        }
        
        function addPerformanceInfo(id){
        	$("#id").val(id);
        	$("#fraction").val("");
			$("#msg").val("");
			$("#date").val("");
        	if(id!=null && id!=""){
        		$.post("${contextPath}/index/get_mark_byid.json", {
                	"id":id
				}, function(ms) {
					var usergrade = ms.usergrade;
					if(usergrade!=null){
						$("#fraction").val(usergrade.fraction);
						$("#msg").val(usergrade.msg);
						$("#date").val(usergrade.date);
					}
                });
        	}
        	
                
			$('.theme-popover-mask').fadeIn(100);
           	$('.theme-popover').slideDown(200);
            $('.theme-poptit .close').click(function(){
            $('.theme-popover-mask').fadeOut(100);
                $('.theme-popover').slideUp(200);
            })
        }
        
        function save(){
        		var id = $("#id").val();
                var username = $("#username").val();
                var fraction = $("#fraction").val();
                var msg = $("#msg").val();
                
                if(username==""){
					infopad.err("请选择接待咨询师!");
					return;
				}
				if(fraction==""){
					infopad.err("请填写分数!");
					return;
				}
				if(msg==""){
					infopad.err("请填写评语!");
					return;
				}
			if(confirm("注意：每月初为上个月工作表现进行打分，打分后不可修改。")){
                $.post("${contextPath}/index/add_mark.json", {
                	"id":id,
					"username":username,
					"fraction":fraction,
					"msg":msg
				}, function(ms) {
					 if (ms.msg=="1"){
                         infopad.msg("添加成功");
                         location.reload();
                     }else if (ms.msg=="0"){
                         infopad.err("该记录已经存在!");
                     }
                });
            }
        }
    </script>
</head>

<body>
<input type="hidden" id="id" value="">
<div id="home_link">
    <ul>
        <li></li>
        <li>&gt;</li>
        <li>帐号管理</li>
        <li>&gt;</li>
        <li class="current"></li>
    </ul>
</div>
<div id="container">
    <div id="title"></div>
    <table class="form_table">
        <tr>
            <td><label><b>查询条件：</b></label>
                <label for="nickname">姓名：</label>
                <input type="text" name="nickname" id="nickname" size="15" value="" />
                <label for="nickname">日期：</label>
                <input type="text" id="dates" size="15" maxlength="20" rel="DATE::Y-m" />
                <input type="button" value=" 查 询 " onclick="selectMsg()" />
                <input type="button"  value="添加咨询老师打分 " onclick="addPerformanceInfo()" />
                <input type="button"  value="添加行政老师打分 " onclick="addPerformanceInfo2()" />
            </td>
        </tr>
    </table>
    <table>
        <tr class="fields">
            <th width=100>老师姓名</th>
            <th width=100>日期</th>
            <th width=100>分数</th>
            <th>评语 </th>
            <#if webutil.getCookieUser().username=="system"><th width=100>操作</th></#if>
        </tr>

    <#if list??>
        <#list list as list>
            <tr class="even_row">
                <td align="center" class="stress">
                	${list.nickname2}
                </td>
                
                <td align="center" rel="nohover">${list.date}</td>

                <td align="center">${list.fraction}</td>
                <td align="center">${list.msg}</td>
                <#if webutil.getCookieUser().username=="system"><td align="center"><a href="#" onclick="addPerformanceInfo(${list.id})">编辑</a></td></#if>
            </tr>
        </#list>
    </#if>

    </table>
</div>

<div class="emptyline"></div>
<div class="theme-popover">
    <div class="theme-poptit">
        <a href="javascript:;" title="关闭" class="close">×</a>
        <h3>给咨询老师打分</h3>
    </div>
    <div class="theme-popbod dform">
        <form class="theme-signin" >
            <ol>
                <li><strong>咨询老师：</strong>
                    <select id="username">
                    <#if ulist??>
                    	<option value="">请选择</option>
                        <#list ulist as list>
                            <option value="${list.username}">${list.nickname}（${list.regions}-${list.job}）</option>
                        </#list>
                    </#if>
                    <#if webutil.getCookieUser().username=="zhanglong">
                    	<option value="duyu">杜宁（北京首师大中心-课程顾问）</option>
                	</#if>
                    </select >

                <li><strong>&nbsp;分数 ：</strong>
                	<select id="fraction">
                		<option value="">请选择</option>
                		<option value="1">1分</option>
                		<option value="2">2分</option>
                		<option value="3">3分</option>
                		<option value="4">4分</option>
                		<option value="5">5分</option>
                		<option value="6">6分</option>
                		<option value="7">7分</option>
                		<option value="8">8分</option>
                		<option value="9">9分</option>
                		<option value="10">10分</option>
                		<#if webutil.getCookieUser().username=="zhanglong" || webutil.getCookieUser().username=="system">
                		<option value="11">11分</option>
                		<option value="12">12分</option>
                		<option value="13">13分</option>
                		<option value="14">14分</option>
                		<option value="15">15分</option>
                		<option value="16">16分</option>
                		<option value="17">17分</option>
                		<option value="18">18分</option>
                		<option value="19">19分</option>
                		<option value="20">20分</option>
                		</#if>
                	</select>分
                <li>
                 <li><strong>&nbsp;评语 ：</strong>
                	<textarea placeholder="<#if webutil.getCookieUser().type==1>对日常工作、工作态度、团队精神等进行评价。<#elseif webutil.getCookieUser().type==2>对电话量完成、业绩完成情况、总体表现等进行评价</#if>" style="width:200px;height:100px;" type="text" id="msg" /></textarea>
                <li>
                <li><strong>&nbsp;日期 ：</strong>
                	系统会默认选择上个月日期。
                </li>
                <li>
                    <input class="btn btn-primary" type="button"  onclick="save()" value=" 保 存 " /></li>
            </ol>
        </form>
    </div>
</div>
<div class="theme-popover-mask"></div>
<div id="pager" style="width: 849px;">
    <ul id="pagination">
    <#if page??>
        <#if page.pagetotal?? && page.pagetotal!="0">
            <#assign pagetotal = page.pagetotal>
        <#else>
            <#assign pagetotal = 1>
        </#if>
        <#if page.currpage??>
            <#assign currpage = page.currpage>
        <#else>
            <#assign currpage = 1>
        </#if>
        <#if currpage==1 >
            <li class="previous-off">上一页</li>
        <#else>
            <li class="previous"><a href="${contextPath}/index/markList.htm?currPage=${currpage-1}">上一页</a></li>
        </#if>

        <#if pagetotal<=11>
            <#list 1..pagetotal as index_up>
                <#if currpage==index_up >
                    <li class="current">${index_up}</li>
                <#else>
                    <li><a href="${contextPath}/index/markList.htm?currPage=${index_up}">${index_up}</a></li>
                </#if>
            </#list>
        <#else>
            <#if currpage<=8 >
                <#list 1..9 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li><a href="${contextPath}/index/markList.htm?currPage=${index_up}">${index_up}</a></li>
                    </#if>
                </#list>
                <li>...</li>
                <li><a href="${contextPath}/index/markList.htm?currPage=${pagetotal}">${pagetotal}</a></li>

            <#elseif (currpage>= 9 && currpage<pagetotal-7)  >
                <li><a href="${contextPath}/index/markList.htm?currPage=1">1</a></li>
                <li>...</li>
                <#list currpage-3..currpage+3 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li><a href="${contextPath}/index/markList.htm?currPage=${index_up}">${index_up}</a></li>
                    </#if>
                </#list>
                <li>...</li>
                <li><a href="${contextPath}/index/markList.htm?currPage=${pagetotal}">${pagetotal}</a></li>
            <#else>
                <li><a href="${contextPath}/index/markList.htm?currPage=1">1</a></li>
                <li>...</li>
                <#list pagetotal-8..pagetotal as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li><a href="${contextPath}/index/markList.htm?currPage=${index_up}">${index_up}</a></li>
                    </#if>
                </#list>
            </#if>

        </#if>
        <#if currpage==pagetotal >
            <li class="previous-off">下一页</li>
        <#else>
            <li class="previous"><a href="${contextPath}/index/markList.htm?currPage=${currpage+1}">下一页</a></li>
        </#if>
        <li class="pageinfo">共${page.total}条记录</li>
    </#if>
    </ul>
</div>

</body>
</html>